<template>
    <el-container>
        <el-form :inline="true" :model="formInline" >
            <el-form-item label="审批人">
                <el-input v-model="formInline.user" placeholder="审批人"></el-input>
            </el-form-item>
            <el-form-item label="活动区域">
                <el-select v-model="formInline.region" filterable clearable placeholder="活动区域">
                    <el-option label="区域一" value="shanghai"></el-option>
                    <el-option label="区域二" value="beijing"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button  type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>
        <hr/>
        <div class="learn-drawer-department-box">
            <el-tree :props="props" :load="loadNode" lazy show-checkbox/>
        </div>
    </el-container>
</template>

<script>
  export default {
    name: 'assignBranch',
    data () {
      return {
        formInline: {
          user: '',
          region: ''
        }
      }
    },
    methods: {
      loadNode (node, resolve) {
        if (node.level === 0) {
          return resolve([{name: 'region'}])
        }
        if (node.level > 1) return resolve([])
        setTimeout(() => {
          const data = [{
            name: 'leaf',
            leaf: true
          }, {
            name: 'zone'
          }]

          resolve(data)
        }, 500)
      },
      onSubmit () {
        this.$refs['basicData'].validate((valid) => {
          if (valid) this.step = 1
        })
      }
    }
  }
</script>

<style scoped>

</style>
